import type { Response } from '@/utils/request'

const CommonResponse: Response<null> = {
  code: 0,
  messageid: '',
  msg: '',
  data: null,
}
export function mock<T = null, TArgs extends any[] = any[]>(
  dataGetter?: (...args: TArgs) => T
): () => Promise<Response<T>> {
  return (...args: TArgs) =>
    Promise.resolve({
      ...CommonResponse,
      data: dataGetter?.apply(null, args) || (null as T),
    })
}

export function useVirtualShareNotice() {
  const show = ref(false)
  function open() {
    show.value = true
  }
  return {
    show,
    open,
  }
}
